/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

//package server;

import java.io.IOException;
import java.net.ServerSocket;
import java.util.ArrayList;
/**
 *
 * @author josegarcia
 */
public class MainServer {

	/**
	 * @param args the command line arguments
	 */
	public static void main(String[] args) throws IOException {
		ArrayList<Request> tasks= new ArrayList<Request>(0);
		ServerSocket serverSocket = null;
		Object lockTasks=new Object();

		Boolean listening = new Boolean(true);

		try {
			serverSocket = new ServerSocket(2221);
		} catch (IOException e) {
			System.err.println("Could not listen on port: 2221.");
			System.exit(-1);
		}
               
                (new ExcecThread(tasks,lockTasks,listening)).start();
                (new AdministratorThread(tasks,listening)).start();
		while (listening.booleanValue()){
			(new ListThread(serverSocket.accept(), tasks, lockTasks)).start();
		}

		serverSocket.close();
	}
        private class runner implements Runnable{

        public void run() {
            System.out.println();
        }
    }


}
